<?php
//Define global system constants
defined('SITE') || define('SITE', 1);
define('UPLOADS_DIR', ROOT_DIR.'/public/uploads');
defined('UPLOADS_URL') || define('UPLOADS_URL', BASE_URL.'/uploads');
defined('MIN_ROWS_PER_PAGE') || define('MIN_ROWS_PER_PAGE', 10);

// uncomment the following to define a path alias
// Yii::setPathOfAlias('local','path/to/local-folder');

// This is the main Web application configuration. Any writable
// CWebApplication properties can be configured here.
return array(
	'basePath'=>APPLICATION_DIR, //dirname(__FILE__).DIRECTORY_SEPARATOR.'..',
	'name'=>'My Web Application',
	//'defaultController'=>'app/site',

	// preloading 'log' component
	'preload'=>array('log'),

	// autoloading model and component classes
	'import'=>array(
		'application.models.dao.*',
		'application.models.*',
		'application.components.*',
	),

	'modules'=>array(
		// uncomment the following to enable the Gii tool
		'admincp'=>array(
			'defaultController' => 'index/index'
		),
		'hopsuc'=>array(
			'defaultController' => 'site/index'
		),
		'gii'=>array(
			'class'=>'system.gii.GiiModule',
			'password'=>'123456',
			// If removed, Gii defaults to localhost only. Edit carefully to taste.
			'ipFilters'=>array('127.0.0.1','::1'),
		),
		
	),

	// application components
	'components'=>array(
		'request' => array(
            'baseUrl' => BASE_URL,
        ),
		'user'=>array(
			// page after login
			'returnUrl' => 'index/index',
			// login path
			'loginUrl'=> 'auth/login',
			
			
			// enable cookie-based authentication
			'allowAutoLogin'=>true,
		),
		'admin'=>array(
			'class'=>'AdminWebUser',
			'returnUrl' => array('admincp/index/index'),
			// login path
			'loginUrl'=> 'admincp/auth/login',
		),
		// uncomment the following to enable URLs in path-format
		
		'urlManager'=>array(
			'urlFormat'=>'path',
			'showScriptName'=>false,
			'caseSensitive'=>false,
			'urlSuffix'=>'',
			'rules'=> array_merge(array(
				'/admincp/<controller:\w+>'=>'admincp/<controller>',
				'/admincp/<controller:\w+>/<action:\w+>'=>'admincp/<controller>/<action>',
				'<controller:\w+>/<id:\d+>'=>'<controller>/view',
				'<controller:\w+>/<action:\w+>/<id:\d+>'=>'<controller>/<action>',
				'<controller:\w+>/<action:\w+>'=>'<controller>/<action>'
			), include('routes.php'))
		),
		
		'db'=>array(
			'connectionString' => 'sqlite:'.DATA_DIR.'/db/testdrive.db',
		),
		// uncomment the following to use a MySQL database
		
		'db'=>array(
			'connectionString' => 'mysql:host=localhost;dbname=yiicms',
			'emulatePrepare' => true,
			'username' => 'root',
			'password' => '',
			'charset' => 'utf8',
			'enableParamLogging'=>true,
    		'enableProfiling'=>true,
		),
		'cache'=>array(
            /*'class'=>'system.caching.CMemCache',
            'servers'=>array(
                array('host'=>'server1', 'port'=>11211, 'weight'=>60),
                array('host'=>'server2', 'port'=>11211, 'weight'=>40),
            ),*/
			
			'class'=>'system.caching.CFileCache',
            'cachePath'=>DATA_DIR.'/cache' /*the directory to store cache files. Defaults to null, meaning using 'protected/runtime/cache' as the directory.*/
        ),
		'messages' => array(
			'class'=>'CPhpMessageSource',
			'basePath'=>APPLICATION_DIR.'/messages',
		),
		'errorHandler'=>array(
			// use 'site/error' action to display errors
			'errorAction'=>'site/error',
		),
		'log'=>array(
			'class'=>'CLogRouter',
			'routes'=>array(
				array(
					'class'=>'CFileLogRoute',
					'levels'=>'error, warning',
				),
				// uncomment the following to show log messages on web pages
				/*
				array(
					'class'=>'CWebLogRoute',
				),
				*/
			),
		),
	),

	// application-level parameters that can be accessed
	// using Yii::app()->params['paramName']
	'params'=>array(
		// this is used in contact page
		'adminEmail'=>'webmaster@example.com',
	),
	
	// override the default
    'runtimePath' => DATA_DIR.'/runtime',
);